﻿#region Copyright 
/*-------------------------------------------------------------------------
* 命名空间名称/文件名:    SSPivot.Tools/GlobalConfigTool 
* CLR版本:     4.0.30319.42000
* 机器名称:    DESKTOP-NHMLO8A
* 功 能：       N/A
* 类 名：       GlobalConfigTool
* 创建时间：  2025/5/24 14:55:09
* 版本号：      v1.0
* 创建人:        xulong
*-------------------------------------------------------------------------*/
#endregion
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SSPivot.Tools
{
    /// <summary>
    /// 系统配置
    /// </summary>
    public abstract class GlobalConfigTool 
    { 
        public const string IllegalWordsCahceName = "IllegalWordsCahce";

        public class CacheKeys
        {
            #region CacheKey 
            /// <summary>
            /// 验证码 admin:captcha:guid
            /// </summary>
            [Description("验证码")]
            public const string Captcha = "sspivot:captcha:";  

            /// <summary>
            /// 短信验证码 admin:sms:code:guid
            /// </summary>
            [Description("短信验证码")]
            public const string SmsCode = "sspivot:sys:sms:code:";

            /// <summary>
            /// 邮箱验证码 admin:email:code:guid
            /// </summary>
            [Description("邮箱验证码")]
            public const string EmailCode = "sspivot:sys:email:code:";

            /// <summary>
            /// Excel错误标记文件 admin:excel:error_mark:userId:fileId
            /// </summary>
            [Description("Excel错误标记文件")]
            public const string ExcelErrorMark = "sspivot:excel:error_mark:";

            /// <summary>
            /// 获取短信验证码缓存键
            /// </summary>
            /// <param name="mobile">手机号</param>
            /// <param name="code">唯一码</param>
            /// <returns></returns>
            public static string GetSmsCodeKey(string mobile, string code) => $"{SmsCode}{mobile}:{code}";

            /// <summary>
            /// 获取邮箱验证码缓存键
            /// </summary>
            /// <param name="email">邮件地址</param>
            /// <param name="code">唯一码</param>
            /// <returns></returns>
            public static string GetEmailCodeKey(string email, string code) => $"{EmailCode}{email}:{code}";

            /// <summary>
            /// 获取Excel错误标记文件缓存键
            /// </summary>
            /// <param name="userId">用户Id</param>
            /// <param name="fileId">文件Id</param>
            /// <returns></returns>
            public static string GetExcelErrorMarkKey(long userId, string fileId) => $"{ExcelErrorMark}{userId}{(fileId.IsNotNullOrWhiteSpace() ? (":" + fileId) : "")}";

            #endregion
        }
        public class SubscribeNames
        { 
            /// <summary>
            /// 短信单发
            /// </summary>
            [Description("短信单发")]
            public const string SmsSingleSend = "sspivot.sys.sms:singleSend";

            /// <summary>
            /// 短信验证码发送
            /// </summary>
            [Description("短信验证码发送")]
            public const string SmsSendCode = "sspivot.sys.sms:sendCode";

            /// <summary>
            /// 邮件单发
            /// </summary>
            [Description("邮件单发")]
            public const string EmailSingleSend = "sspivot.sys.email:singleSend";

            /// <summary>
            /// 邮箱验证码发送
            /// </summary>
            [Description("邮箱验证码发送")]
            public const string EmailSendCode = "sspivot.sys.email:sendCode";

        }
    }
}
